#pragma once

#include <iostream>
#include <string>

#include "util.hpp"

namespace ns_log
{
    using namespace ns_util;
    enum
    {
        INFO,
        DEBUG,
        WARNING,
        ERROR,
        FATAL
    };

    //LOG(INFO) << "........" << endl;  开放式日志接口

    inline std::ostream& Log(const std::string &level, const std::string &file_name, int line)
    {
        //[日志等级][文件名][行数][时间戳]
        std::string message = "[";
        message += level;
        message += "][";

        message += file_name;
        message += "][";

        message += std::to_string(line);
        message += "][";


        message += TimeUtil::GetTimeStamp();
        message += "]";

        std::cout << message; //将信息放入输出缓冲区

        return std::cout;
    }

   
    #define LOG(level) Log(#level, __FILE__, __LINE__)
}